Today we will…
A structured way for tracking changes to files over the course of a project.
Makes it easy to have multiple people working on the same files at the same time.
You can host a URL of fun things (like the class text, these slides, a personal website, etc.) with GitHub pages.
Think “track-changes” or “drop-box” history, but more structured.
You may have code, documentation, data, TODO lists, and more associated with a project.
To create a repository, you can start with your local computer first, or you can start with the online repository first.
Git tracks changes to each file that it is told to monitor, and as the files change, you provide short labels describing what the changes were and why they exist (called “commits”).
The log of these changes (along with the file history) is called your git commit history. This means you can always go back to old copies!
Updates the copy of the repository on another machine (e.g. on GitHub) so that it has the most recent changes you’ve made to your machine.
Updates your local copy of the repository (the copy on your computer) with the files that are “in the cloud” (on GitHub).
Starting a new project/local repo
Starting a new project/local repo
Working with an existing local repo
Work in your terminal or an .Rscript for this…
Generate tokenWarning
GitHub really doesn’t like it when you do not have a PAT expiration date… but I don’t ever want to deal with it again. Make sure your expiration date is AT LEAST through the end of the quarter (60 days).
Enter password or token: Paste PATYou should be good to go! Let’s verify.
Collaborating within a GitHub Repo
Designate each person to one of the suits – you will be referencing it as you work through this activity.
Warning
If you only have 3 group members here, assign one person both and
.
Please use sticky notes to indicate how your group is doing:
Green
– we are ready to move onYellow
– we’re figuring it outPink
– Please help!!stat-331-PA6
.gitignore template: RSettings tab > Click on Collaborators > Add people
File > New Project > Version Control > Git (pause)<> Code and paste into the repository address line in RStudioBrowse and navigate to where you want to create your new project. I recommend creating this on your desktop.Danger
Do not save this within your master stat 331 folder!!! We don’t want to embbed and Rproject within an RProject.
Create the project!PA6.qmdself-contained: true to the YAMLPA6.qmd and PA6.html files with an explanatory message such as “Created practice activity quarto file”
Everyone should now have the .qmd and .html files on their local computers!
Do not pull the changes that were made!
Danger
Oh no 😨 You got an error! Ugh. We forgot to pull before we started making changes 😢
Tip
Note how the conflicting lines are marked! You might need to submit this to Canvas 😄
Do not pull the changes that were made!
Warning
You will get an error, read it, and pull.
No merge conflicts should occur. Now push your changes.
Do not pull the changes that were made!
Danger
You will get an error. Ugh!!!! We forgot to pull again!
Pull, and observe the changes in your document.
Note
How does Git mark the start of lines with a merge conflict? Specifically, I want the four capital letter characters with which every conflict is marked.
Always pull before you start working and always push after you are done working!
In general, if you follow the workflow for an existing local repo exactly, you only have problems if two of you are making local changes to the same line in the same file at the same time.
If you are working with collaborators in real time, pull, commit, and push often.
Git commits lines – lines of code, lines of text, etc.
Burn your local repo to the ground and clone again.
NO CLASS MONDAY, 2/20
Final Project Group Contract
Final Project Proposals
Read Chapter 7: Writing Functions